package org.example.simple_factory;

/**
 * @author Zhang Yu
 * @description: 简单工厂模式:定义一个专门的工厂类来负责创建其他类的实例
 * @date 2024/5/20 14:05
 */
public class Test {
    public static void main(String[] args) {
        Operation operation = OperationFactory.createOperate("+");
        operation.setNumberA(5);
        operation.setNumberB(10);
        double result = 0;
        try {
            result = operation.getResult();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("result = " + result);
    }
}
